/**
    Die Ewigen Extension
    Copyright (C) 2011 DonKrieg @ sonkyu@googlemail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

shrinkDailyGiftBoxes = function(shrink) {
    if(shrink == "on") {
        $('#g0, #g1, #g2, #g3, #g4, #g5, #g6').css({
            height: "50px",
            'background-repeat': "none",
            'padding-top': "30px",
            'padding-bottom': "30px",
            '-webkit-background-size': "470px 110px"
        });
    }
    else {
        $('#g0, #g1, #g2, #g3, #g4, #g5, #g6').css({
            height: "366px",
            'background-repeat': "none",
            'padding-top': "52px",
            'padding-bottom': "52px",
            '-webkit-background-size': "470px 470px"
        });
    }
}

// we already have a stored value for this
if(localStorage['sde_daily_gift'] != undefined) {
    shrinkDailyGiftBoxes(localStorage['sde_daily_gift']);
}

chrome.extension.sendRequest(
        {
            action  : "retrieveData",
            key     : "sde_daily_gift"
        }, function(response) {
            var old = localStorage['sde_daily_gift'];
            localStorage['sde_daily_gift'] = response.value;

            if(old != localStorage['sde_daily_gift']) {
                shrinkDailyGiftBoxes(localStorage['sde_daily_gift']);
            }
        }
);


